#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long LL;
int n;
string s;
int main()
{
	cin >> n;
	cin >> s;
	LL sum = 0;
	for (int i = s.size() - 1; i >= 0; i--) {
		sum = 2 * sum + (s[i] == 'R');
	}
	LL ans = pow(2, n) - 1 - sum;
	cout << ans << endl;
	return 0;
}